import request from '@/router/axios';

export const getList = (current, size, params) => {
        return request({
            url: '/api/beetles-business/account/page',
            method: 'get',
            params: {
                ...params,
                current,
                size,
            }
        })
    }
    //导出excal
export const exportOrders = (current, size, params) => {
    return request({
        url: '/api/beetles-business/account/exp-excel',
        method: 'get',
        responseType: 'blob',
        params: {
            ...params,
            current,
            size,
        }
    })
}

export const getSimpleList = (params) => {
    return request({
        url: '/api/beetles-business/account/simple-list',
        method: 'get',
        params: {
            ...params,
        }
    })
}

export const getSimpleListWithOp = (params) => {
    return request({
        url: '/api/beetles-business/account/simple-list-withop',
        method: 'get',
        params: {
            ...params,
        }
    })
}


export const getOfferAccountPage = (current, size, params, userId, offerId) => {
    return request({
        url: '/api/beetles-business/account/offer-account-page',
        method: 'get',
        params: {
            ...params,
            current,
            size,
            userId,
            offerId
        }
    })
}
export const selectoperator = (id) => {
    return request({
        url: '/api/beetles-business/operatoraccount/selectoperator',
        method: 'get',
        params: {
            id: id
        }
    })
}
export const accountoperator = (id) => {
    return request({
        url: '/api/beetles-business/operatoraccount/accountoperator',
        method: 'get',
        params: {
            id: id
        }
    })
}
export const customerAccount = (id) => {
    return request({
        url: '/api/beetles-business/operatoraccount/customerAccount',
        method: 'get',
        params: {}
    })
}
export const selectDate = (id) => {
    return request({
        url: '/api/beetles-business/operatoraccount/selectDate',
        method: 'get',
        params: {
            id: id
        }
    })
}
export const Operator = () => {
    return request({
        url: '/api/blade-user/Operator',
        method: 'get',
    })
}
export const selectCustomer = (id) => {
    return request({
        url: '/api/beetles-business/account/selectCustomer',
        method: 'get',
        params: {
            accountid: id
        }
    })
}
export const selectDCustomer = () => {
    return request({
        url: '/api/beetles-business/account/selectDCustomer',
        method: 'get',
        params: {}
    })
}

export const getDetail = (id) => {
    return request({
        url: '/api/beetles-business/account/detail',
        method: 'get',
        params: {
            id
        }
    })
}

export const remove = (ids) => {
    return request({
        url: '/api/beetles-business/account/remove',
        method: 'post',
        params: {
            ids,
        }
    })
}

export const add = (row) => {
    return request({
        url: '/api/beetles-business/account/submit',
        method: 'post',
        data: row
    })
}

export const update = (row) => {
    return request({
        url: '/api/beetles-business/account/submit',
        method: 'post',
        data: row
    })
}

export const getCostReport = (mode) => {
    return request({
        url: '/api/beetles-business/account/statistics-cost-report',
        method: 'get',
        params: {
            mode
        }
    })
}
export const selecterror = (list) => {
    return request({
        url: '/api/beetles-business/account/selecterror',
        method: 'get',
        params: {
            list: list
        }
    })
}
export const getCostOfferInOpReport = () => {
    return request({
        url: '/api/beetles-business/account/statistics-offer-in-op-cost',
        method: 'get'
    })
}
export const getCostOpInOfferReport = () => {
    return request({
        url: '/api/beetles-business/account/statistics-op-in-offer-cost',
        method: 'get'
    })
}
export const getCostPlatformIdInOpReport = () => {
    return request({
        url: '/api/beetles-business/account/statistics-platformid-in-op-cost',
        method: 'get'
    })
}
export const getCostSalesManagerCustomerOfferReport = () => {
    return request({
        url: '/api/beetles-business/account/statistics-sales-customer-offer-cost',
        method: 'get'
    })
}
export const getCostPlatformOfferReport = () => {
    return request({
        url: '/api/beetles-business/account/statistics-platform-offer-cost',
        method: 'get'
    })
}

export const getExternalAccount = (offerId) => {
    return request({
        url: '/api/beetles-business/account/get-external-account',
        method: 'get',
        params: { offerId }
    })
}

export const getPlatformByOffer = (offerId) => {
    return request({
        url: '/api/beetles-business/offer/get-platform-by-offer-select',
        method: 'get',
        params: {
            offerId
        }
    })
}

export const changeOperator = (id, userId) => {
    return request({
        url: '/api/beetles-business/account/change-operator',
        method: 'put',
        params: {
            id,
            userId
        }
    })
}

export const getOfferAccount = (offerId) => {
    return request({
        url: '/api/beetles-business/account/select/offer-account',
        method: 'get',
        params: {
            offerId
        }
    })
}

export const getOfferOperator = (offerId) => {
    return request({
        url: '/api/beetles-business/account/select/offer-operator',
        method: 'get',
        params: {
            offerId
        }
    })
}

export const getOperatorList = () => {
    return request({
        url: '/api/blade-user/Operator',
        method: 'get',
    })
}

// 第三方账号对比
export const comparePlatformAccount = (data) => {
    return request({
        url: '/api/beetles-business/account/compare-platform-account',
        method: 'post',
        data: data
    })
}

//批量新增
export const batchAddAccounts = (data) => {
        return request({
            url: '/api/beetles-business/account/batch-add-accounts',
            method: 'post',
            data: data
        })
    }
    /*导出定制报表花费报告数据数据*/
export const exportAccountSpend = (data) => {
    return request({
        responseType: 'blob',
        url: '/api/beetles-business/account/export-account-spend',
        method: 'post',
        data: data
    })
}

export const getAccountsInfoByPLAndOffer = (params) => {
    return request({
        url: "/api/beetles-business/account/get-accounts-info-by-platform-offids",
        method: 'get',
        params: params
    })
}


export const batchUpateTimezone = (params) => {
        return request({
            url: "/api/beetles-business/account/batch-update-timezone",
            method: 'post',
            params: params
        })
    }
    //获取账户信息变更记录
export const accountUpdateInformation = (accountId, page) => {
    return request({
        url: "/api/beetles-business/account/get-account-changelog",
        method: 'get',
        params: {
            accountId,
            ...page
        }
    })
}

export const changeStatus = (ids, status) => {
    return request({
        url: '/api/beetles-business/account/change-status',
        method: 'put',
        params: {
            ids: ids,
            status: status,
        }
    })
}
